/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import edu.uah.math.distributions.BernoulliDistribution;
import edu.uah.math.distributions.Distribution;
import edu.uah.math.distributions.ExponentialDistribution;
import edu.uah.math.distributions.PoissonDistribution;

/**
 *
 * @author gravena
 */
public class VMTask {
    public enum DIST{POISSON,BERNOULLI,EXPONENTIAL};
    private Distribution distribution;
    private long startTime; /* Start time for the experiment, in terms of the client clock */
    private long chunk;     /* Size of the simulation */
    private DIST type;

    public VMTask(DIST type, double p1) {
        this.type = type;
        if(type == VMTask.DIST.EXPONENTIAL) {
            this.distribution = new ExponentialDistribution(p1);
        } else if (type == VMTask.DIST.POISSON) {
            this.distribution = new PoissonDistribution(p1);
        } else if (type == VMTask.DIST.BERNOULLI) {
            this.distribution = new BernoulliDistribution(p1);
        }
    }

    public VMTask() {
        this.type = VMTask.DIST.POISSON;
        this.distribution = new PoissonDistribution(1.0);
    }
    
    public double simulate() {
        return this.distribution.simulate();
    }

    public static void main(String args[]) {
        VMTask task = new VMTask(DIST.POISSON, 1.0);

        for(int i=0;i<100;i++) {
            System.out.println(task.simulate());
        }
    }

}
